﻿using System;
using Examples.HelloWorldPVCM.UI.Views;
using Hrunga.PVCM.Framework;

namespace Examples.HelloWorldPVCM.UI.Presenters
{
    /// <summary>
    /// The Presenter for the HelloWorldView
    /// </summary>
    public class HelloWorldPresenter : PresenterBase<IHelloWorldView>
    {
        /// <summary>
        /// Starts the presenter.
        /// </summary>
        protected override void StartPresenter()
        {
            this.View.SubmitName.Text = "Submit Your Name";
            HookUpEvents();
        }

        /// <summary>
        /// Hooks up events.
        /// </summary>
        protected virtual void HookUpEvents()
        {
            this.View.SubmitName.Click += OnSubmitNameClick;
        }

        private void OnSubmitNameClick(object sender, EventArgs eventArgs)
        {
            this.View.SubmitName.Text = "Thanks";
            this.View.SubmitName.Enabled = false;
            this.View.Message.Text = String.Format("Hello: {0}", this.View.Name.Text);
        }

       
    }
}
